<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('牛舍精液列表')"/>
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">


        <div class="col-sm-12 search-collapse">
            <span class="btn-group " style="margin: 0px auto;display: table;" role="group" >
                <button type="button" id="ncBullJingye" class="top-link btn btn-sm btn-primary">精液管理</button>
                <button type="button" id="ncBullJingyeLog" class="top-link btn-sm btn-white">出库记录</button>
            </span>
        </div>


        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            公牛耳号：<select id="bullCode" name="bullCode" >
                            <option value="" selected="selected">无</option>
                            <option th:each="cow:${cows}" th:value="${cow.childCode}" th:text="${cow.childCode}"></option>
                                     </select>
                        </li>

                        <li class="select-time">
                            <label>入库时间： </label>
                            <input type="text" class="time-input" id="beginTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>


                        <!--<li>
                            来源：<input type="text" name="comeFrom"/>
                        </li>-->

                      <!--  <li>
                            库存(支)：<input type="text" name="stockAmout"/>
                        </li>

                        <li>
                            数量(支)：<input type="text" name="inputAmount"/>
                        </li>-->

                        <li>
                            采购人：<input type="text" name="purchaser"/>
                            <!--<select id="purchaser" name="purchaser" >
                                <option value="" selected="selected">无</option>
                                <option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
                             </select>-->
                        </li>

                        <li>
                            经手人：<input type="text" name="createBy"/>
                            <!--<select id="createBy" name="createBy" >
                                <option value="" selected="selected">无</option>
                                <option th:each="user:${users}" th:value="${user.loginName}" th:text="${user.loginName}"></option>
                            </select>-->
                        </li>

                        <!--<li>
                            备注：<input type="text" name="remark"/>
                        </li>-->

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncBullJingye:add">
                <i class="fa fa-plus"></i> 添加
            </a>
             <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
                shiro:hasPermission="system:ncBullJingye:edit">
                 <i class="fa fa-edit"></i> 修改
             </a>
             <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
                shiro:hasPermission="system:ncBullJingye:remove">
                 <i class="fa fa-remove"></i> 删除
             </a>
             <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncBullJingye:export">
                 <i class="fa fa-download"></i> 导出
             </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncBullJingye:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncBullJingye:remove')}]];
    var prefix = ctx + "system/ncBullJingye";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "牛舍精液",
            uniqueId : "jingyeId",
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field: 'jingyeId',
                    title: '精液Id',
                    visible: false
                  },
                {
                    field: 'bullCode',
                    title: '公牛耳号',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '入库时间',
                    sortable: true
                },
                {
                    field: 'comeFrom',
                    title: '来源',
                    sortable: true
                },
                {
                    field: 'stockAmout',
                    title: '库存(支)',
                    sortable: true
                },
                {
                    field: 'inputAmount',
                    title: '数量(支)',
                    sortable: true
                },
                {
                    field: 'purchaser',
                    title: '采购人',
                    sortable: true
                },
                {
                    field: 'createBy',
                    title: '经手人',
                    sortable: true
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.jingyeId + '\')"><i class="fa fa-edit"></i>修改</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.jingyeId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-info btn-xs' + '" href="javascript:void(0)" onclick="checkOutCowJingYe(\'' + row.jingyeId + '\')"><i class="fa fa-remove"></i>出库</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);


        $("#ncBullJingye").click(function () {
            window.location.href = ctx + 'system/ncBullJingye';
            return;
        });

        $("#ncBullJingyeLog").click(function () {
            window.location.href = ctx + 'system/ncBullJingyeLog';
            return;

        });
    });


    function checkOutCowJingYe(jingyeId) {
        // var url = ctx + "system/ncBullJingyeLog/add/jyid";
        var url = ctx + "system/ncBullJingye/checkOut/" + jingyeId ;
        $.modal.open("出库确认", url);

    }
    setTitle("兽医管理-精液管理",true)
</script>
</body>
</html>